package com.example.base.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.viewbinding.ViewBinding
import com.example.base.R
import com.example.base.base.util.inflateBindingWithGeneric

open class BaseBindingDialog<VB : ViewBinding>: BaseDialog() {

    private var _binding: VB? = null
    val binding: VB get() = _binding!!

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        val viewRoot = FrameLayout(inflater.context)
        _binding = inflateBindingWithGeneric(layoutInflater, viewRoot, false)
        viewRoot.addView(binding.root)
        return viewRoot
    }
}